/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package consumo.entity;

import java.io.Serializable;
import java.util.List;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author Carlos Taschetto
 */
@Entity
@Table(name = "posto_horario", catalog = "consumodb", schema = "")
@NamedQueries({
    @NamedQuery(name = "PostoHorario.findAll", query = "SELECT p FROM PostoHorario p"),
    @NamedQuery(name = "PostoHorario.findById", query = "SELECT p FROM PostoHorario p WHERE p.id = :id"),
    @NamedQuery(name = "PostoHorario.findByP1", query = "SELECT p FROM PostoHorario p WHERE p.p1 = :p1"),
    @NamedQuery(name = "PostoHorario.findByP2", query = "SELECT p FROM PostoHorario p WHERE p.p2 = :p2"),
    @NamedQuery(name = "PostoHorario.findByP3", query = "SELECT p FROM PostoHorario p WHERE p.p3 = :p3"),
    @NamedQuery(name = "PostoHorario.findByP4", query = "SELECT p FROM PostoHorario p WHERE p.p4 = :p4"),
    @NamedQuery(name = "PostoHorario.findByFp1", query = "SELECT p FROM PostoHorario p WHERE p.fp1 = :fp1"),
    @NamedQuery(name = "PostoHorario.findByFp2", query = "SELECT p FROM PostoHorario p WHERE p.fp2 = :fp2"),
    @NamedQuery(name = "PostoHorario.findByFp3", query = "SELECT p FROM PostoHorario p WHERE p.fp3 = :fp3"),
    @NamedQuery(name = "PostoHorario.findByFp4", query = "SELECT p FROM PostoHorario p WHERE p.fp4 = :fp4"),
    @NamedQuery(name = "PostoHorario.findByR1", query = "SELECT p FROM PostoHorario p WHERE p.r1 = :r1"),
    @NamedQuery(name = "PostoHorario.findByR2", query = "SELECT p FROM PostoHorario p WHERE p.r2 = :r2"),
    @NamedQuery(name = "PostoHorario.findByR3", query = "SELECT p FROM PostoHorario p WHERE p.r3 = :r3"),
    @NamedQuery(name = "PostoHorario.findByR4", query = "SELECT p FROM PostoHorario p WHERE p.r4 = :r4")})
public class PostoHorario implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id", nullable = false)
    private Integer id;
    @Column(name = "p1")
    @Temporal(TemporalType.TIME)
    private Date p1;
    @Column(name = "p2")
    @Temporal(TemporalType.TIME)
    private Date p2;
    @Column(name = "p3")
    @Temporal(TemporalType.TIME)
    private Date p3;
    @Column(name = "p4")
    @Temporal(TemporalType.TIME)
    private Date p4;
    @Column(name = "fp1")
    @Temporal(TemporalType.TIME)
    private Date fp1;
    @Column(name = "fp2")
    @Temporal(TemporalType.TIME)
    private Date fp2;
    @Column(name = "fp3")
    @Temporal(TemporalType.TIME)
    private Date fp3;
    @Column(name = "fp4")
    @Temporal(TemporalType.TIME)
    private Date fp4;
    @Column(name = "r1")
    @Temporal(TemporalType.TIME)
    private Date r1;
    @Column(name = "r2")
    @Temporal(TemporalType.TIME)
    private Date r2;
    @Column(name = "r3")
    @Temporal(TemporalType.TIME)
    private Date r3;
    @Column(name = "r4")
    @Temporal(TemporalType.TIME)
    private Date r4;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "postoHorario")
    private List<Leitura> leituraList;

    public PostoHorario() {
    }

    public PostoHorario(Integer id) {
        this.id = id;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Date getP1() {
        return p1;
    }

    public void setP1(Date p1) {
        this.p1 = p1;
    }

    public Date getP2() {
        return p2;
    }

    public void setP2(Date p2) {
        this.p2 = p2;
    }

    public Date getP3() {
        return p3;
    }

    public void setP3(Date p3) {
        this.p3 = p3;
    }

    public Date getP4() {
        return p4;
    }

    public void setP4(Date p4) {
        this.p4 = p4;
    }

    public Date getFp1() {
        return fp1;
    }

    public void setFp1(Date fp1) {
        this.fp1 = fp1;
    }

    public Date getFp2() {
        return fp2;
    }

    public void setFp2(Date fp2) {
        this.fp2 = fp2;
    }

    public Date getFp3() {
        return fp3;
    }

    public void setFp3(Date fp3) {
        this.fp3 = fp3;
    }

    public Date getFp4() {
        return fp4;
    }

    public void setFp4(Date fp4) {
        this.fp4 = fp4;
    }

    public Date getR1() {
        return r1;
    }

    public void setR1(Date r1) {
        this.r1 = r1;
    }

    public Date getR2() {
        return r2;
    }

    public void setR2(Date r2) {
        this.r2 = r2;
    }

    public Date getR3() {
        return r3;
    }

    public void setR3(Date r3) {
        this.r3 = r3;
    }

    public Date getR4() {
        return r4;
    }

    public void setR4(Date r4) {
        this.r4 = r4;
    }

    public List<Leitura> getLeituraList() {
        return leituraList;
    }

    public void setLeituraList(List<Leitura> leituraList) {
        this.leituraList = leituraList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof PostoHorario)) {
            return false;
        }
        PostoHorario other = (PostoHorario) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "consumo.persistence.PostoHorario[id=" + id + "]";
    }

}
